﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CanDoo.Data.Entity;
using CanDoo.Oil.Core.Models;

namespace CanDoo.Oil.Core.ModelConfigurations
{
    /// <summary>
    /// 实体类-数据表映射——销售出库单
    /// </summary>
    public class OutStoreConfiguration : EntityConfigurationBase<OutStore>
    {
        /// <summary>
        /// 初始化一个<see cref="OutStoreConfiguration"/>类型的新实例
        /// </summary>
        public OutStoreConfiguration()
        {
             ToTable("sell_OutStore");
             this.Property(p => p.OutOrderId).HasColumnName("OutOrderId");
             this.HasOptional(p => p.OutOrder).WithMany().HasForeignKey(p => p.OutOrderId).WillCascadeOnDelete(false);

             this.Property(p => p.UserId).HasColumnName("UserId");
             this.HasRequired(p => p.User).WithMany().HasForeignKey(p => p.UserId).WillCascadeOnDelete(false);

             this.Property(p => p.CustomerId).HasColumnName("CustomerId");
             this.HasRequired(p => p.Customer).WithMany().HasForeignKey(p => p.CustomerId).WillCascadeOnDelete(false);

             this.Property(p => p.WarehouseId).HasColumnName("WarehouseId");
             this.HasRequired(p => p.Warehouse).WithMany().HasForeignKey(p => p.WarehouseId).WillCascadeOnDelete(false);

        }
    }
}
